package com.niit.spark.sql.test

import org.apache.spark.sql.{DataFrame, SparkSession}

/**
 * Date:2025/5/14
 * Author：Ys
 * Description:
 */
object JoinDataFrames {

  def main(args: Array[String]): Unit = {

    val spark = SparkSession.builder().appName("JoinDataFrames").master("local[*]").getOrCreate()
    spark.sparkContext.setLogLevel("ERROR")
    import spark.implicits._

    val emp: DataFrame = spark.read.option("header", "true").csv("input/sql/employees1.csv")
    val dep : DataFrame = spark.read.option("header", "true").csv("input/sql/departments1.csv")

    emp.join(dep,emp("department_id") === dep("id"),"inner").show()
    


    spark.stop()


  }

}
